﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using Viewer.BusinessObject.BusinessEntities;

namespace Viewer.ChucNang
{
    public partial class PagePhanQuyenByModule : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData_NhomQuyenByModule();
            }
        }

        public void BindData_NhomQuyenByModule()
        {
            var oQUNhomQuyenByModule = new QUNhomQuyenByModule();
            storeNhomQuyenByModule.DataSource = oQUNhomQuyenByModule.GetAllWithCurrentUserOwner();
            storeNhomQuyenByModule.DataBind();
            //PagingToolbar1.PageSize = 10;
            //PagingToolbar1.PageIndex = 1;
        }

        protected void ShowDialog_NhomQuyenByModule_AddNew(object sender, DirectEventArgs e)
        {
            ucNhomQuyenByModule.ShowAddNewDialog();
        }

        [DirectMethod]
        public void ShowDialog_NhomQuyenByMoDule_Edit(int pNhomQuyenByModuleId)
        {
            ucNhomQuyenByModule.ShowEditDialog(pNhomQuyenByModuleId);
        }

        [DirectMethod]
        public void ShowDialog_QUNhomQuyenByModule_Detail(int pNhomQuyenByModuleId)
        {
            ucNhomQuyenByModule.ShowDetailDialog(pNhomQuyenByModuleId);
        }

        [DirectMethod]
        public void NhomQuyenByToChuc_Delete(int pNhomQuyenByModuleId)
        {
            QUNhomQuyenByModule oItem = new QUNhomQuyenByModule();
            oItem = oItem.GetById(pNhomQuyenByModuleId);
            oItem.Delete();
            BindData_NhomQuyenByModule();
        }
    }
}
